/*
 * Compressed by JSA(www.xidea.org)
 */
$(function () {
    var _ = $("#jz"), C = $("#login"), A = $("#username"), B = $("#password"), H = $("#msg"), D = function ($) {
        H.css("display", "table").html($);
        H.fadeOut(300);
        H.fadeIn(300)
    }, G = function () {
        var E = A.val(), C = B.val();
        if ("" == E) {
            D("\u8bf7\u60a8\u8f93\u5165\u8d26\u53f7");
            return
        } else if ("" == C) {
            D("\u8bf7\u60a8\u8f93\u5165\u5bc6\u7801");
            return
        }
        $.post("login", {uname: E, pwd: C}, function ($) {
            "true" == $ ? (D("\u767b\u9646\u6210\u529f!\u7b49\u7a0d\u540e..."), window.location = "admin/" + new Date().getTime()) : D($)
        });
        if (_.is(":checked")) I(E, C)
    }, I = function (B, A) {
        var _ = 7;
        $.cookie("user", B, {expires: _});
        $.cookie("pwd", A, {expires: _});
        $.cookie("checked", true, {expires: _})
    }, E = function () {
        $.cookie("user", "", {expires: -1});
        $.cookie("pwd", "", {expires: -1});
        $.cookie("checked", "", {expires: -1})
    }, F = function () {
        if ($.cookie("checked")) {
            _.attr("checked", true);
            A.val($.cookie("user"));
            B.val($.cookie("pwd"))
        }
    };
    C.click(G);
    $(window).keydown(function ($) {
        "13" == $.keyCode && G()
    });
    _.change(function () {
        if (!_.is(":checked")) E()
    });
    F()
})